﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using DBUtility;//请先添加引用
namespace TierApplication
{
    /// <summary>
    /// 类T_OrderPayFee。
    /// </summary>
    [Serializable]
    public partial class T_OrderPayFee
    {
        public T_OrderPayFee()
        { }
        #region Model
        private string _payfeeid;
        private string _orderid;
        private DateTime? _payfeedate;
        private string _payfeeuserid;
        private decimal? _payfee;
        private string _payfeeno;
        private string _contractno;
        private string _ordercode;
        private string _audituserid;
        private DateTime? _auditdate;
        private string _auditremark;
        private string _remark;
        private int? _sign = 0;
        private DateTime? _createdate = DateTime.Now;
        private string _createuser;
        private string _remark1;
        private string _remark2;
        /// <summary>
        /// 
        /// </summary>
        public string PayFeeID
        {
            set { _payfeeid = value; }
            get { return _payfeeid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderID
        {
            set { _orderid = value; }
            get { return _orderid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? PayFeeDate
        {
            set { _payfeedate = value; }
            get { return _payfeedate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayFeeUserID
        {
            set { _payfeeuserid = value; }
            get { return _payfeeuserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? PayFee
        {
            set { _payfee = value; }
            get { return _payfee; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayFeeNo
        {
            set { _payfeeno = value; }
            get { return _payfeeno; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string ContractNo
        {
            set { _contractno = value; }
            get { return _contractno; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderCode
        {
            set { _ordercode = value; }
            get { return _ordercode; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string AuditUserID
        {
            set { _audituserid = value; }
            get { return _audituserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? AuditDate
        {
            set { _auditdate = value; }
            get { return _auditdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string AuditRemark
        {
            set { _auditremark = value; }
            get { return _auditremark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Remark
        {
            set { _remark = value; }
            get { return _remark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int? Sign
        {
            set { _sign = value; }
            get { return _sign; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? CreateDate
        {
            set { _createdate = value; }
            get { return _createdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string CreateUser
        {
            set { _createuser = value; }
            get { return _createuser; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Remark1
        {
            set { _remark1 = value; }
            get { return _remark1; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Remark2
        {
            set { _remark2 = value; }
            get { return _remark2; }
        }
        #endregion Model


        #region  Method

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public T_OrderPayFee(string PayFeeID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select PayFeeID,OrderID,PayFeeDate,PayFeeUserID,PayFee,PayFeeNo,ContractNo,OrderCode,AuditUserID,AuditDate,AuditRemark,Remark,Sign,CreateDate,CreateUser,Remark1,Remark2 ");
            strSql.Append(" FROM [T_OrderPayFee] ");
            strSql.Append(" where PayFeeID=@PayFeeID ");
            SqlParameter[] parameters = {
					new SqlParameter("@PayFeeID", SqlDbType.VarChar,-1)};
            parameters[0].Value = PayFeeID;

            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PayFeeID"] != null)
                {
                    this.PayFeeID = ds.Tables[0].Rows[0]["PayFeeID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderID"] != null)
                {
                    this.OrderID = ds.Tables[0].Rows[0]["OrderID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayFeeDate"] != null && ds.Tables[0].Rows[0]["PayFeeDate"].ToString() != "")
                {
                    this.PayFeeDate = DateTime.Parse(ds.Tables[0].Rows[0]["PayFeeDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayFeeUserID"] != null)
                {
                    this.PayFeeUserID = ds.Tables[0].Rows[0]["PayFeeUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayFee"] != null && ds.Tables[0].Rows[0]["PayFee"].ToString() != "")
                {
                    this.PayFee = decimal.Parse(ds.Tables[0].Rows[0]["PayFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayFeeNo"] != null)
                {
                    this.PayFeeNo = ds.Tables[0].Rows[0]["PayFeeNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ContractNo"] != null)
                {
                    this.ContractNo = ds.Tables[0].Rows[0]["ContractNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderCode"] != null)
                {
                    this.OrderCode = ds.Tables[0].Rows[0]["OrderCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditUserID"] != null)
                {
                    this.AuditUserID = ds.Tables[0].Rows[0]["AuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditDate"] != null && ds.Tables[0].Rows[0]["AuditDate"].ToString() != "")
                {
                    this.AuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["AuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AuditRemark"] != null)
                {
                    this.AuditRemark = ds.Tables[0].Rows[0]["AuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null)
                {
                    this.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Sign"] != null && ds.Tables[0].Rows[0]["Sign"].ToString() != "")
                {
                    this.Sign = int.Parse(ds.Tables[0].Rows[0]["Sign"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateDate"] != null && ds.Tables[0].Rows[0]["CreateDate"].ToString() != "")
                {
                    this.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateUser"] != null)
                {
                    this.CreateUser = ds.Tables[0].Rows[0]["CreateUser"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark1"] != null)
                {
                    this.Remark1 = ds.Tables[0].Rows[0]["Remark1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark2"] != null)
                {
                    this.Remark2 = ds.Tables[0].Rows[0]["Remark2"].ToString();
                }
            }
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string PayFeeID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from [T_OrderPayFee]");
            strSql.Append(" where PayFeeID=@PayFeeID ");

            SqlParameter[] parameters = {
					new SqlParameter("@PayFeeID", SqlDbType.VarChar,-1)};
            parameters[0].Value = PayFeeID;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into [T_OrderPayFee] (");
            strSql.Append("PayFeeID,OrderID,PayFeeDate,PayFeeUserID,PayFee,PayFeeNo,ContractNo,OrderCode,AuditUserID,AuditDate,AuditRemark,Remark,Sign,CreateDate,CreateUser,Remark1,Remark2)");
            strSql.Append(" values (");
            strSql.Append("@PayFeeID,@OrderID,@PayFeeDate,@PayFeeUserID,@PayFee,@PayFeeNo,@ContractNo,@OrderCode,@AuditUserID,@AuditDate,@AuditRemark,@Remark,@Sign,@CreateDate,@CreateUser,@Remark1,@Remark2)");
            SqlParameter[] parameters = {
					new SqlParameter("@PayFeeID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderID", SqlDbType.VarChar,10),
					new SqlParameter("@PayFeeDate", SqlDbType.DateTime),
					new SqlParameter("@PayFeeUserID", SqlDbType.VarChar,10),
					new SqlParameter("@PayFee", SqlDbType.Decimal,9),
					new SqlParameter("@PayFeeNo", SqlDbType.VarChar,50),
					new SqlParameter("@ContractNo", SqlDbType.VarChar,50),
					new SqlParameter("@OrderCode", SqlDbType.VarChar,50),
					new SqlParameter("@AuditUserID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditDate", SqlDbType.DateTime),
					new SqlParameter("@AuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@Remark", SqlDbType.VarChar,200),
					new SqlParameter("@Sign", SqlDbType.Int,4),
					new SqlParameter("@CreateDate", SqlDbType.DateTime),
					new SqlParameter("@CreateUser", SqlDbType.VarChar,20),
					new SqlParameter("@Remark1", SqlDbType.VarChar,50),
					new SqlParameter("@Remark2", SqlDbType.VarChar,50)};
            parameters[0].Value = PayFeeID;
            parameters[1].Value = OrderID;
            parameters[2].Value = PayFeeDate;
            parameters[3].Value = PayFeeUserID;
            parameters[4].Value = PayFee;
            parameters[5].Value = PayFeeNo;
            parameters[6].Value = ContractNo;
            parameters[7].Value = OrderCode;
            parameters[8].Value = AuditUserID;
            parameters[9].Value = AuditDate;
            parameters[10].Value = AuditRemark;
            parameters[11].Value = Remark;
            parameters[12].Value = Sign;
            parameters[13].Value = CreateDate;
            parameters[14].Value = CreateUser;
            parameters[15].Value = Remark1;
            parameters[16].Value = Remark2;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update [T_OrderPayFee] set ");
            strSql.Append("OrderID=@OrderID,");
            strSql.Append("PayFeeDate=@PayFeeDate,");
            strSql.Append("PayFeeUserID=@PayFeeUserID,");
            strSql.Append("PayFee=@PayFee,");
            strSql.Append("PayFeeNo=@PayFeeNo,");
            strSql.Append("ContractNo=@ContractNo,");
            strSql.Append("OrderCode=@OrderCode,");
            strSql.Append("AuditUserID=@AuditUserID,");
            strSql.Append("AuditDate=@AuditDate,");
            strSql.Append("AuditRemark=@AuditRemark,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("Sign=@Sign,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("CreateUser=@CreateUser,");
            strSql.Append("Remark1=@Remark1,");
            strSql.Append("Remark2=@Remark2");
            strSql.Append(" where PayFeeID=@PayFeeID ");
            SqlParameter[] parameters = {
					new SqlParameter("@OrderID", SqlDbType.VarChar,10),
					new SqlParameter("@PayFeeDate", SqlDbType.DateTime),
					new SqlParameter("@PayFeeUserID", SqlDbType.VarChar,10),
					new SqlParameter("@PayFee", SqlDbType.Decimal,9),
					new SqlParameter("@PayFeeNo", SqlDbType.VarChar,50),
					new SqlParameter("@ContractNo", SqlDbType.VarChar,50),
					new SqlParameter("@OrderCode", SqlDbType.VarChar,50),
					new SqlParameter("@AuditUserID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditDate", SqlDbType.DateTime),
					new SqlParameter("@AuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@Remark", SqlDbType.VarChar,200),
					new SqlParameter("@Sign", SqlDbType.Int,4),
					new SqlParameter("@CreateDate", SqlDbType.DateTime),
					new SqlParameter("@CreateUser", SqlDbType.VarChar,20),
					new SqlParameter("@Remark1", SqlDbType.VarChar,50),
					new SqlParameter("@Remark2", SqlDbType.VarChar,50),
					new SqlParameter("@PayFeeID", SqlDbType.VarChar,10)};
            parameters[0].Value = OrderID;
            parameters[1].Value = PayFeeDate;
            parameters[2].Value = PayFeeUserID;
            parameters[3].Value = PayFee;
            parameters[4].Value = PayFeeNo;
            parameters[5].Value = ContractNo;
            parameters[6].Value = OrderCode;
            parameters[7].Value = AuditUserID;
            parameters[8].Value = AuditDate;
            parameters[9].Value = AuditRemark;
            parameters[10].Value = Remark;
            parameters[11].Value = Sign;
            parameters[12].Value = CreateDate;
            parameters[13].Value = CreateUser;
            parameters[14].Value = Remark1;
            parameters[15].Value = Remark2;
            parameters[16].Value = PayFeeID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string PayFeeID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from [T_OrderPayFee] ");
            strSql.Append(" where PayFeeID=@PayFeeID ");
            SqlParameter[] parameters = {
					new SqlParameter("@PayFeeID", SqlDbType.VarChar,-1)};
            parameters[0].Value = PayFeeID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public void GetModel(string PayFeeID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select PayFeeID,OrderID,PayFeeDate,PayFeeUserID,PayFee,PayFeeNo,ContractNo,OrderCode,AuditUserID,AuditDate,AuditRemark,Remark,Sign,CreateDate,CreateUser,Remark1,Remark2 ");
            strSql.Append(" FROM [T_OrderPayFee] ");
            strSql.Append(" where PayFeeID=@PayFeeID ");
            SqlParameter[] parameters = {
					new SqlParameter("@PayFeeID", SqlDbType.VarChar,-1)};
            parameters[0].Value = PayFeeID;

            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PayFeeID"] != null)
                {
                    this.PayFeeID = ds.Tables[0].Rows[0]["PayFeeID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderID"] != null)
                {
                    this.OrderID = ds.Tables[0].Rows[0]["OrderID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayFeeDate"] != null && ds.Tables[0].Rows[0]["PayFeeDate"].ToString() != "")
                {
                    this.PayFeeDate = DateTime.Parse(ds.Tables[0].Rows[0]["PayFeeDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayFeeUserID"] != null)
                {
                    this.PayFeeUserID = ds.Tables[0].Rows[0]["PayFeeUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayFee"] != null && ds.Tables[0].Rows[0]["PayFee"].ToString() != "")
                {
                    this.PayFee = decimal.Parse(ds.Tables[0].Rows[0]["PayFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayFeeNo"] != null)
                {
                    this.PayFeeNo = ds.Tables[0].Rows[0]["PayFeeNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ContractNo"] != null)
                {
                    this.ContractNo = ds.Tables[0].Rows[0]["ContractNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderCode"] != null)
                {
                    this.OrderCode = ds.Tables[0].Rows[0]["OrderCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditUserID"] != null)
                {
                    this.AuditUserID = ds.Tables[0].Rows[0]["AuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditDate"] != null && ds.Tables[0].Rows[0]["AuditDate"].ToString() != "")
                {
                    this.AuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["AuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AuditRemark"] != null)
                {
                    this.AuditRemark = ds.Tables[0].Rows[0]["AuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null)
                {
                    this.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Sign"] != null && ds.Tables[0].Rows[0]["Sign"].ToString() != "")
                {
                    this.Sign = int.Parse(ds.Tables[0].Rows[0]["Sign"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateDate"] != null && ds.Tables[0].Rows[0]["CreateDate"].ToString() != "")
                {
                    this.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateUser"] != null)
                {
                    this.CreateUser = ds.Tables[0].Rows[0]["CreateUser"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark1"] != null)
                {
                    this.Remark1 = ds.Tables[0].Rows[0]["Remark1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark2"] != null)
                {
                    this.Remark2 = ds.Tables[0].Rows[0]["Remark2"].ToString();
                }
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM [T_OrderPayFee] ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        #endregion  Method
    }
}

